package trancations.dao.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import trancations.dao.UserDao;

/**
 * @author wang fei
 * @date 2020-10-12 10:01
 */
@Repository
public class UserDaoImpl implements UserDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * lucy转账给mary100
     */
    public void addMoney() {
        String sql = "update count set money = money+? where user_name = ?";
        jdbcTemplate.update(sql,100,"mary");
    }

    public void reduceMoney() {
        String sql = "update count set money = money-? where user_name = ?";
        jdbcTemplate.update(sql,100,"lucy");
    }
}
